-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
agent group flag for introspeciton commands #2826
Conversation
WalkthroughThe changes primarily focus on enhancing the functionality of the Changes
TipsChat with CodeRabbit Bot (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Files ignored due to filter (6)
- api/buf.lock
- api/gen/proto/go/aperture/cmd/v1/cmd.pb.go
- api/gen/proto/go/aperture/cmd/v1/cmd.pb.json.go
- api/gen/proto/go/aperture/cmd/v1/cmd.pb.validate.go
- api/gen/proto/go/aperture/cmd/v1/cmd_grpc.pb.go
- api/gen/proto/go/aperture/cmd/v1/cmd_vtproto.pb.go
Files selected for processing (13)
- api/aperture/cmd/v1/cmd.proto (3 hunks)
- cmd/aperturectl/cmd/agents.go (2 hunks)
- cmd/aperturectl/cmd/cloud/agents.go (2 hunks)
- cmd/aperturectl/cmd/cloud/discovery/entities.go (2 hunks)
- cmd/aperturectl/cmd/discovery/entities.go (2 hunks)
- cmd/aperturectl/cmd/utils/agents.go (1 hunks)
- cmd/aperturectl/cmd/utils/controller-client.go (1 hunks)
- cmd/aperturectl/cmd/utils/discovery.go (2 hunks)
- docs/content/reference/aperturectl/agents/agents.md (1 hunks)
- docs/content/reference/aperturectl/cloud/agents/agents.md (1 hunks)
- docs/content/reference/aperturectl/discovery/entities/entities.md (1 hunks)
- pkg/agent-functions/agents/agents.go (5 hunks)
- pkg/cmd/controller.go (2 hunks)
Files skipped from review due to trivial changes (1)
- docs/content/reference/aperturectl/agents/agents.md
Additional comments (Suppressed): 26
docs/content/reference/aperturectl/cloud/agents/agents.md (1)
- 23-29: The addition of the
--agent-group
flag is well documented here. Ensure that the functionality of this flag is also explained in the Synopsis or Description section of the documentation for clarity.--agent-group string Name of the agent group to list agents forcmd/aperturectl/cmd/cloud/agents.go (2)
15-15: The new
--agent-group
flag is introduced correctly. Ensure that the flag is documented in the user guide or help command.33-35: The
ListAgents
function now acceptsListAgentsRequest
instead ofEmpty
. This change is consistent with the PR summary. Make sure to update all calls to this function throughout the codebase.docs/content/reference/aperturectl/discovery/entities/entities.md (1)
- 33-39: The new
--agent-group
option has been added to the command-line interface. Ensure that the implementation of this option correctly filters the agents based on the provided group name. Also, verify that the documentation and help messages throughout the codebase have been updated to reflect this new option.cmd/aperturectl/cmd/utils/agents.go (1)
- 10-16: The function signature of
ListAgents
has been changed to include anagentGroup
parameter. Ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that theagentGroup
string is being correctly passed to theListAgentsRequest
.cmd/aperturectl/cmd/cloud/discovery/entities.go (3)
9-12: The introduction of the
agentGroup
variable is a good addition to allow users to specify an agent group when listing agents or discovery entities. Ensure that theagentGroup
variable is properly sanitized before use to prevent potential security issues.15-16: The addition of the
agent-group
flag to theEntitiesCmd
command is a good way to allow users to specify an agent group when listing agents or discovery entities. Ensure that the flag is properly documented in the user guide or help command.36-36: The
ParseEntities
function now takes an additional argumentagentGroup
. Ensure that the function definition ofParseEntities
is updated to handle this new argument and that all calls to this function throughout the codebase have been updated to match the new signature.cmd/aperturectl/cmd/agents.go (2)
12-12: The
--agent-group
flag is added to theagentsCmd
command. Ensure that the flag is documented in the user guide or help command.30-30: The function
utils.ListAgents
now requires an additional argumentagentGroup
. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.cmd/aperturectl/cmd/utils/controller-client.go (1)
- 22-22: The function signature for
ListAgents
has been changed from accepting anemptypb.Empty
parameter to acmdv1.ListAgentsRequest
parameter. Ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that the newcmdv1.ListAgentsRequest
parameter is being properly populated where this function is called.pkg/cmd/controller.go (2)
44-52: The function signature for
ListAgents
has been changed to accept aListAgentsRequest
instead ofEmpty
. This change is in line with the PR summary, but ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that theGetAgentsForGroup
function in theAgents
package correctly handles theAgentGroup
field from the request.157-163: Similar to the
ListAgents
function, theListDiscoveryEntities
function now accepts aListDiscoveryEntitiesRequest
instead ofEmpty
. Ensure that all calls to this function have been updated to match the new signature. Also, verify that theListDiscoveryEntities
function in theAgents
package correctly handles theAgentGroup
field from the request.cmd/aperturectl/cmd/utils/discovery.go (2)
15-16: The function signature of
ParseEntities
has been changed to include an additional parameteragentGroup
. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.55-57: The
ListDiscoveryEntities
function now accepts anagentGroup
parameter. This is a good improvement as it allows for more specific queries, reducing the amount of data that needs to be processed and returned.api/aperture/cmd/v1/cmd.proto (3)
16-16: The
ListAgents
RPC method has been updated to acceptListAgentsRequest
instead ofgoogle.protobuf.Empty
. Ensure that all calls to this method throughout the codebase have been updated to match the new signature. Also, verify that the server-side implementation of this method has been updated to handle the new request type.77-79: The
ListDiscoveryEntitiesRequest
message type has been updated to include anagent_group
field. This change allows the caller to specify an agent group when listing discovery entities. Ensure that all uses of this message type in the codebase have been updated to include the new field if necessary. Also, verify that the server-side implementation of theListDiscoveryEntities
method has been updated to handle the new field.101-103: The
ListAgentsRequest
message type has been introduced with anagent_group
field. This change allows the caller to specify an agent group when listing agents. Ensure that all uses of this message type in the codebase have been updated to include the new field if necessary. Also, verify that the server-side implementation of theListAgents
method has been updated to handle the new field.cmd/aperturectl/cmd/discovery/entities.go (3)
15-18: The new variable
agentGroup
is introduced to specify the agent group for which the agents are to be listed. This is a good addition for filtering agents based on groups.20-23: The
agentGroup
flag is added to theEntitiesCmd
command. Ensure that the flag is documented in the user guide or help command.78-86: The
ListDiscoveryEntities
function now accepts anagentGroup
parameter. This is a good addition for filtering discovery entities based on agent groups. However, it's important to handle the case where the providedagentGroup
does not exist. If theListDiscoveryEntities
function does not already handle this, consider adding error handling for this case.pkg/agent-functions/agents/agents.go (5)
4-10: The new imports
fmt
andstrings
are used for error handling and string manipulation respectively. Ensure that these packages are used in a way that doesn't introduce any potential issues such as format string vulnerabilities.46-49: The function
ListFlowControlPoints
now sends requests to the "default" agent group instead of all agents. This change could affect the behavior of the function if there are multiple agent groups. Make sure this change is intended and that it doesn't break any existing functionality.56-68: The function
ListDiscoveryEntities
now accepts anagentGroup
parameter and uses it to get the agents for that group. This is a breaking change if there are any existing calls to this function that don't provide this parameter. Make sure all calls to this function have been updated to match the new signature.76-79: The function
ListDiscoveryEntity
now uses theflattenAgents
function to get the first agent from the list of agents. This could change the behavior of the function if the order of the agents is important. Make sure this change is intended and that it doesn't break any existing functionality.100-158: The
GetAgents
function has been significantly refactored to return a map of agent groups to agents instead of a list of agents. This is a breaking change if there are any existing calls to this function that expect a list of agents. Make sure all calls to this function have been updated to handle the new return type. The newGetAgentsForGroup
function andflattenAgents
function have been added to support the new agent group functionality. These functions appear to be implemented correctly, but make sure they are tested thoroughly to catch any potential issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Files selected for processing (1)
- docs/content/reference/aperturectl/cloud/discovery/entities/entities.md (1 hunks)
Additional comments (Suppressed): 1
docs/content/reference/aperturectl/cloud/discovery/entities/entities.md (1)
- 33-39: The new
--agent-group
flag has been added to the options. Ensure that the implementation of this flag is correctly handled in the code and that it doesn't break any existing functionality. Also, update any relevant documentation or help text to include this new option.
1a15d9e
to
d819d61
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 2
Files ignored due to filter (5)
- api/gen/proto/go/aperture/cmd/v1/cmd.pb.go
- api/gen/proto/go/aperture/cmd/v1/cmd.pb.json.go
- api/gen/proto/go/aperture/cmd/v1/cmd.pb.validate.go
- api/gen/proto/go/aperture/cmd/v1/cmd_grpc.pb.go
- api/gen/proto/go/aperture/cmd/v1/cmd_vtproto.pb.go
Files selected for processing (14)
- api/aperture/cmd/v1/cmd.proto (3 hunks)
- cmd/aperturectl/cmd/agents.go (2 hunks)
- cmd/aperturectl/cmd/cloud/agents.go (2 hunks)
- cmd/aperturectl/cmd/cloud/discovery/entities.go (2 hunks)
- cmd/aperturectl/cmd/discovery/entities.go (2 hunks)
- cmd/aperturectl/cmd/utils/agents.go (1 hunks)
- cmd/aperturectl/cmd/utils/controller-client.go (1 hunks)
- cmd/aperturectl/cmd/utils/discovery.go (2 hunks)
- docs/content/reference/aperturectl/agents/agents.md (1 hunks)
- docs/content/reference/aperturectl/cloud/agents/agents.md (1 hunks)
- docs/content/reference/aperturectl/cloud/discovery/entities/entities.md (1 hunks)
- docs/content/reference/aperturectl/discovery/entities/entities.md (1 hunks)
- pkg/agent-functions/agents/agents.go (5 hunks)
- pkg/cmd/controller.go (2 hunks)
Files skipped from review due to trivial changes (1)
- docs/content/reference/aperturectl/agents/agents.md
Additional comments (Suppressed): 28
docs/content/reference/aperturectl/discovery/entities/entities.md (1)
- 36-36: The new
--agent-group
flag has been added correctly to the options list. Ensure that the functionality of this flag has been implemented correctly in the code and that it is working as expected. Also, verify that the flag's description is accurate and clear to the users.cmd/aperturectl/cmd/utils/agents.go (1)
- 10-16: The function
ListAgents
now takes an additional parameteragentGroup
. Ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that theagentGroup
string is being correctly populated and passed in all contexts whereListAgents
is called.docs/content/reference/aperturectl/cloud/agents/agents.md (1)
- 26-26: The addition of the
--agent-group
flag is consistent with the summary of the pull request. Ensure that the functionality of this flag has been properly implemented and tested in the codebase. Also, verify that the flag's behavior is correctly documented, i.e., it should filter the agents based on the specified agent group.cmd/aperturectl/cmd/utils/controller-client.go (1)
- 22-22: The function signature for
ListAgents
has been changed to accept aListAgentsRequest
instead ofEmpty
. Ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that theListAgentsRequest
message includes theagent_group
field as mentioned in the PR summary.cmd/aperturectl/cmd/cloud/agents.go (2)
11-11: The new flag
--agent-group
is introduced to filter the agents by group. Ensure that the flag is properly documented and users are aware of its usage.29-29: The
ListAgents
function is now being called with theagentGroup
parameter. Make sure that the function handles the case whenagentGroup
is an empty string (i.e., the flag is not provided by the user), and it should list all agents as it did before.docs/content/reference/aperturectl/cloud/discovery/entities/entities.md (1)
- 33-39: The new
--agent-group
flag has been added to the options for the entities command. This allows users to specify an agent group when listing agents. Ensure that the functionality of this flag has been thoroughly tested and that the documentation accurately reflects its usage and behavior.cmd/aperturectl/cmd/utils/discovery.go (2)
15-16: The function signature of
ParseEntities
has been changed to include an additional parameteragentGroup
. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.55-57: The
ListDiscoveryEntities
function now accepts anagentGroup
parameter. This is a good improvement as it allows for more specific queries, reducing the amount of data that needs to be processed and returned, which can lead to performance improvements.cmd/aperturectl/cmd/agents.go (2)
12-12: The new flag
--agent-group
is introduced to filter the agents by group. Ensure that the flag is properly documented and users are aware of its functionality. Also, verify that the flag is working as expected in different scenarios, such as when the group name is not provided, when an invalid group name is provided, and when a valid group name is provided.30-30: The function
ListAgents
now takes an additional argumentagentGroup
. Ensure that this change is reflected wherever this function is called. Also, verify that the function handles theagentGroup
argument correctly, especially in edge cases like when theagentGroup
is an empty string or when it doesn't match any existing agent group.cmd/aperturectl/cmd/cloud/discovery/entities.go (2)
16-16: The
agent-group
flag has been added to theEntitiesCmd
command. Ensure that the flag is properly documented and that users are aware of its functionality and usage.36-36: The
ParseEntities
function now takes an additionalagentGroup
argument. Ensure that the function handles this new argument correctly, especially in cases where it might be an empty string or a group that doesn't exist.api/aperture/cmd/v1/cmd.proto (3)
16-16: The
ListAgents
RPC method now takes aListAgentsRequest
instead ofgoogle.protobuf.Empty
. Ensure that all calls to this method have been updated to pass aListAgentsRequest
object. Also, make sure that the server-side implementation of this method has been updated to handle the new request type.77-79: The
ListDiscoveryEntitiesRequest
message now includes anagent_group
field. This change allows the caller to specify an agent group when listing discovery entities. Ensure that all uses of this message have been updated to include theagent_group
field if necessary.101-103: The
ListAgentsRequest
message now includes anagent_group
field. This change allows the caller to specify an agent group when listing agents. Ensure that all uses of this message have been updated to include theagent_group
field if necessary.pkg/cmd/controller.go (2)
44-52: The function signature for
ListAgents
has been changed to accept aListAgentsRequest
instead ofEmpty
. This change is consistent with the PR summary. However, ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that theGetAgentsForGroup
function correctly handles the case wherereq.AgentGroup
is empty or null, as this could potentially break existing functionality if not handled properly.157-163: Similar to the
ListAgents
function, theListDiscoveryEntities
function now accepts aListDiscoveryEntitiesRequest
instead ofEmpty
. Again, ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that theListDiscoveryEntities
function correctly handles the case wherereq.AgentGroup
is empty or null.cmd/aperturectl/cmd/discovery/entities.go (2)
15-18: The new variable
agentGroup
is introduced to specify the agent group for which the agents are to be listed. This is a good addition for filtering the agents based on their group.20-23: The
--agent-group
flag is added to theEntitiesCmd
command. This allows users to specify an agent group when listing agents. Ensure that the flag is documented and users are aware of its usage.pkg/agent-functions/agents/agents.go (8)
4-10: The new imports
fmt
andstrings
are used for error handling and string manipulation respectively. Ensure that these packages are used in a way that aligns with the project's standards.46-49: The
flattenAgents
function is used to convert the map of agent groups to agent hostnames into a single slice of agent hostnames. This is a change from the previous version where theagents
variable was already a slice. Ensure that this change does not affect the functionality of theListFlowControlPoints
function.56-59: Similar to the previous comment, the
flattenAgents
function is used here to convert the map of agent groups to agent hostnames into a single slice of agent hostnames. Ensure that this change does not affect the functionality of theListAutoScaleControlPoints
function.63-68: The
ListDiscoveryEntities
function now accepts anagentGroup
parameter and uses theGetAgentsForGroup
function to get the agents for the specified group. This is a change from the previous version where theGetAgents
function was used to get all agents. Ensure that this change does not affect the functionality of theListDiscoveryEntities
function.76-79: The
flattenAgents
function is used here to convert the map of agent groups to agent hostnames into a single slice of agent hostnames. The first agent from the flattened list is used for theSendRequest
function. This is a change from the previous version where the first agent from theagents
slice was used. Ensure that this change does not affect the functionality of theListDiscoveryEntity
function.100-133: The
GetAgents
function has been significantly modified. It now returns a map of agent groups to agent hostnames instead of a slice of agent hostnames. The function also now extracts the agent group from the etcd key. Ensure that these changes do not affect the functionality of theGetAgents
function and that the agent group is correctly extracted from the etcd key.135-150: The new
GetAgentsForGroup
function gets the agents for a specified agent group by calling theGetAgents
function and filtering the returned map for the specified group. If no group is specified, it defaults to the "default" group. Ensure that this function correctly gets the agents for the specified group and that the default behavior is as expected.152-158: The new
flattenAgents
function converts the map of agent groups to agent hostnames into a single slice of agent hostnames. This function is used in several places in the code to convert the output of theGetAgents
function into a format that can be used by theSendRequests
andSendRequest
functions. Ensure that this function correctly flattens the map and that it does not affect the functionality of the functions that use it.
Signed-off-by: Sahil Lakhwani <[email protected]>
Signed-off-by: Sahil Lakhwani <[email protected]>
Signed-off-by: Sahil Lakhwani <[email protected]>
d819d61
to
c3f9f60
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Files ignored due to filter (5)
- api/gen/proto/go/aperture/cmd/v1/cmd.pb.go
- api/gen/proto/go/aperture/cmd/v1/cmd.pb.json.go
- api/gen/proto/go/aperture/cmd/v1/cmd.pb.validate.go
- api/gen/proto/go/aperture/cmd/v1/cmd_grpc.pb.go
- api/gen/proto/go/aperture/cmd/v1/cmd_vtproto.pb.go
Files selected for processing (14)
- api/aperture/cmd/v1/cmd.proto (3 hunks)
- cmd/aperturectl/cmd/agents.go (2 hunks)
- cmd/aperturectl/cmd/cloud/agents.go (2 hunks)
- cmd/aperturectl/cmd/cloud/discovery/entities.go (2 hunks)
- cmd/aperturectl/cmd/discovery/entities.go (2 hunks)
- cmd/aperturectl/cmd/utils/agents.go (1 hunks)
- cmd/aperturectl/cmd/utils/controller-client.go (1 hunks)
- cmd/aperturectl/cmd/utils/discovery.go (2 hunks)
- docs/content/reference/aperturectl/agents/agents.md (1 hunks)
- docs/content/reference/aperturectl/cloud/agents/agents.md (1 hunks)
- docs/content/reference/aperturectl/cloud/discovery/entities/entities.md (1 hunks)
- docs/content/reference/aperturectl/discovery/entities/entities.md (1 hunks)
- pkg/agent-functions/agents/agents.go (5 hunks)
- pkg/cmd/controller.go (2 hunks)
Files skipped from review due to trivial changes (1)
- docs/content/reference/aperturectl/agents/agents.md
Additional comments (Suppressed): 27
cmd/aperturectl/cmd/agents.go (2)
12-12: The new flag
agent-group
is introduced to filter agents by group. Ensure that the flag is documented and users are aware of its usage. Also, verify that the flag is handled correctly in theListAgents
function.30-30: The function
ListAgents
now takes an additional argumentagentGroup
. Ensure that all calls to this function throughout the codebase have been updated to match the new signature.- return utils.ListAgents(client) + return utils.ListAgents(client, agentGroup)docs/content/reference/aperturectl/discovery/entities/entities.md (1)
- 33-39: The new
--agent-group
flag is introduced correctly in the documentation. Ensure that the flag is working as expected in the actual code and that it's properly tested.docs/content/reference/aperturectl/cloud/agents/agents.md (1)
- 23-29: The addition of the
--agent-group
flag is well documented here. Ensure that the functionality of this flag is also explained in the Synopsis or Description section of the documentation for clarity.docs/content/reference/aperturectl/cloud/discovery/entities/entities.md (1)
- 33-39: The new
--agent-group string
option is introduced to allow users to specify an agent group when listing agents. Ensure that the implementation of this option correctly filters the agents based on the provided agent group. Also, update the documentation to explain what happens when the provided agent group does not exist or does not have any agents.cmd/aperturectl/cmd/utils/agents.go (1)
- 10-16: The function
ListAgents
now takes an additional parameteragentGroup
. Ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that theagentGroup
string is being sanitized and validated before being used in theListAgentsRequest
to prevent potential security issues.- func ListAgents(client IntrospectionClient) error { + func ListAgents(client IntrospectionClient, agentGroup string) error {cmd/aperturectl/cmd/utils/controller-client.go (1)
- 22-22: The function signature of
ListAgents
has been changed. It now accepts a*cmdv1.ListAgentsRequest
instead of*emptypb.Empty
. Ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that the new request type is properly handled in the function's implementation.cmd/aperturectl/cmd/cloud/discovery/entities.go (3)
9-12: The introduction of the
agentGroup
variable is a good addition to allow users to specify an agent group when listing agents or discovery entities. This change is consistent with the PR summary.15-16: The addition of the
agent-group
flag to theEntitiesCmd
command is consistent with the PR summary. Ensure that the flag's usage is documented in the user guide or help command.36-36: The
ParseEntities
function now takes an additional argumentagentGroup
. Ensure that the function definition and all its calls throughout the codebase have been updated to match this new signature.pkg/cmd/controller.go (2)
44-52: The function signature of
ListAgents
has been changed to accept aListAgentsRequest
instead ofemptypb.Empty
. This change is likely due to the addition of the--agent-group
flag. Ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that theGetAgentsForGroup
function correctly handles the case wherereq.AgentGroup
is empty or null, as this could potentially lead to unexpected behavior.157-163: The function signature of
ListDiscoveryEntities
has been changed to accept aListDiscoveryEntitiesRequest
instead ofemptypb.Empty
. This change is likely due to the addition of the--agent-group
flag. Ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that theListDiscoveryEntities
function correctly handles the case wherereq.AgentGroup
is empty or null, as this could potentially lead to unexpected behavior.cmd/aperturectl/cmd/discovery/entities.go (2)
17-22: The addition of the
agentGroup
variable and the--agent-group
flag is a good way to allow users to specify an agent group when listing agents or discovery entities. Ensure that the new flag is documented in the user guide or help command.81-83: The
ListDiscoveryEntities
function now accepts anagentGroup
parameter. This is a significant change and it's important to ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that theListDiscoveryEntities
function handles the case whereagentGroup
is an empty string, as the--agent-group
flag defaults to an empty string.cmd/aperturectl/cmd/cloud/agents.go (2)
11-11: The
agentGroup
flag is added to theagentsCmd
command. Ensure that the flag is properly documented and users are aware of its usage and implications.29-29: The
ListAgents
function has been replaced withutils.ListAgents
. Ensure that the new function has the same functionality as the old one and that it handles theagentGroup
parameter correctly. Also, make sure that error handling is properly implemented in theutils.ListAgents
function.cmd/aperturectl/cmd/utils/discovery.go (2)
15-18: The function signature of
ParseEntities
has been changed to include an additional parameteragentGroup
. Ensure that all calls to this function throughout the codebase have been updated to match the new signature. Also, verify that theagentGroup
parameter is being correctly passed in all function calls.55-57: The
ListDiscoveryEntitiesRequest
now includes anAgentGroup
field. This is a significant change and it's important to ensure that the server-side RPCListDiscoveryEntities
is updated to handle this new field. Also, verify that theagentGroup
is being correctly populated in the request.api/aperture/cmd/v1/cmd.proto (3)
16-16: The
ListAgents
RPC method has been updated to accept aListAgentsRequest
instead ofgoogle.protobuf.Empty
. This change is in line with the PR summary, which mentions that theListAgents
RPC is being modified to accept a new request type that includes anagent_group
field. Ensure that all calls to this RPC throughout the codebase have been updated to match the new signature.77-79: The
ListDiscoveryEntitiesRequest
message now includes anagent_group
field. This is consistent with the PR summary, which mentions that theListDiscoveryEntities
RPC is being modified to accept a new request type that includes anagent_group
field. Ensure that all instances ofListDiscoveryEntitiesRequest
in the codebase are updated to include this new field.101-103: The
ListAgentsRequest
message has been added with anagent_group
field. This is consistent with the PR summary, which mentions that theListAgents
RPC is being modified to accept a new request type that includes anagent_group
field. Ensure that all instances ofListAgentsRequest
in the codebase are updated to include this new field.pkg/agent-functions/agents/agents.go (6)
4-10: The new hunk introduces two new imports:
fmt
andstrings
. Ensure that these are necessary for the new code and that they are used in the codebase. If they are not used, they should be removed to keep the code clean and maintainable.46-49: The
flattenAgents
function is used here to convert the map of agent groups to a slice of agent hostnames. This is a change from the previous version where theagents
slice was used directly. This change seems to be in line with the new functionality of handling agent groups.56-59: Similar to the previous comment, the
flattenAgents
function is used here to convert the map of agent groups to a slice of agent hostnames. This change seems to be in line with the new functionality of handling agent groups.63-68: The function signature of
ListDiscoveryEntities
has been changed to include anagentGroup
parameter. This is a breaking change and all calls to this function throughout the codebase should be updated to match the new signature. Also, the function now callsGetAgentsForGroup
instead ofGetAgents
, which is in line with the new functionality of handling agent groups.76-79: The
flattenAgents
function is used here to convert the map of agent groups to a slice of agent hostnames. This is a change from the previous version where theagents
slice was used directly. This change seems to be in line with the new functionality of handling agent groups. However, it's worth noting that only the first agent from the flattened list is used. If the order of agents matters, this could potentially lead to inconsistent results.100-158: The
GetAgents
function has been significantly modified to return a map of agent groups to agent hostnames instead of a slice of agent hostnames. This is a breaking change and all calls to this function throughout the codebase should be updated to match the new return type. The newGetAgentsForGroup
function retrieves agents for a specific group, which is a new functionality. TheflattenAgents
function is a helper function that converts the map of agent groups to a slice of agent hostnames. These changes seem to be in line with the new functionality of handling agent groups.
Description of change
--agent-group
for introspection commands wherever neededChecklist
Summary by CodeRabbit
--agent-group
flag added to theaperturectl agents
andaperturectl cloud agents
commands.aperturectl discovery entities
command with the ability to specify the agent group and the entity to find by name or IP.aperturectl
commands to reflect the new features and usage.ListAgents
andListDiscoveryEntities
functions to accept specific request parameters, improving the flexibility and specificity of agent and entity listing.These changes provide users with more control and specificity when listing agents and discovery entities, improving usability and efficiency.